package com.recycle.config;

import com.recycle.filter.UserInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.nio.charset.StandardCharsets;

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

   @Resource
   UserInterceptor userInterceptor;
   @Override
   public void addInterceptors(InterceptorRegistry registry) {
//       registry.addInterceptor(userInterceptor)
//               .addPathPatterns("/**").excludePathPatterns("/**/login")
//               .excludePathPatterns("/**/getCategory");
   }
   @Bean
   public HttpMessageConverter<String> responseBodyConverter() {
      StringHttpMessageConverter converter = new StringHttpMessageConverter(StandardCharsets.UTF_8);
      return converter;
   }
}
